import { Service, Container } from 'typedi';
import { Create{{pascalCase name}}Dto, Update{{pascalCase name}}Dto } from '@/dtos';
import { I{{pascalCase name}} } from '@/interfaces';
import { PrismaClient } from '@/generated/prisma';
import Redis from 'ioredis';

@Service()
export class {{pascalCase name}}Service {
  public token_redis: Redis = Container.get('REDIS_TOKEN');
  public online_redis: Redis = Container.get('REDIS_ONLINE');
  public prisma: PrismaClient = Container.get('PRISMA_CLIENT');

  async findAll(): Promise<I{{pascalCase name}}[]> {
    // TODO: 调用 prisma
    return [];
  }

  async findOne(id: number): Promise<I{{pascalCase name}} | null> {
    // TODO
    return null;
  }

  async create(dto: Create{{pascalCase name}}Dto): Promise<I{{pascalCase name}}> {
    // TODO
    return {} as any;
  }

  async update(id: number, dto: Update{{pascalCase name}}Dto): Promise<I{{pascalCase name}}> {
    // TODO
    return {} as any;
  }

  async remove(id: number): Promise<void> {
    // TODO
  }
}
